﻿using System;
using System.Collections.Generic; 
using System.Text;
using ATSModel;
using ATSIDAL;

namespace ATSBLL
{
    public class TRelevance : BaseService<TRelevanceInfo>
    {
        private static readonly ITRelevance dal = DALFactory.DataAccess.CreateTRelevance();
       
        public override void SetCurrentRepository()
        {
            CurrentRepository = dal;
        }

        /// <summary>
        /// 上传关联信息
        /// </summary> 
        /// <returns>bool</returns> 
        public bool UploalRelevanceData(TRelevanceInfo tr)
        {
            TRelevance tRelevance = new TRelevance();
          //上传关联数据  
            try
            {
                tRelevance.Insert(tr);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return true;
        }


        /// <summary>
        /// 检测条码是否关联
        /// </summary> 
        /// <returns>bool</returns> 
        public bool IsRelevance(string SN)
        { 
            //关联数据  
            if (!string.IsNullOrEmpty(dal.IsRelevance(SN).RetrospectSN)
                || !string.IsNullOrEmpty(dal.IsRelevance(SN).ProductSN))
            {
                return true;
            }
            return false;
        } 
        
    }
}
